package com.kuangqi.paymentdemo.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Configuration

public class MyRedissonConfig {
    /**
     * 使用redis的单节点模式
     *
     * @return
     */
    @Bean(destroyMethod = "shutdown")
    RedissonClient redisson() {

        Config config = new Config();
        config.useSingleServer().setAddress("redis://121.199.22.217:6379");
        return Redisson.create(config);
    }
}